home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / pvm34b3.zip / pvm34b3 / pvm3 / libfpvm / pvmfspawn.m4 < prev    next >
Text File  |  1997-07-22  |  978b  |  42 lines

  1.  
  2. /* $Id: pvmfspawn.m4,v 1.2 1996/10/04 15:27:40 pvmsrc Exp $ */
  3.  
  4. #include "pvm3.h"
  5. #include "pvm_consts.h"
  6.  
  7. void
  8. FUNCTION(pvmfspawn) ARGS(`STRING_ARG(aout), flag, STRING_ARG(where), count, tids, info')
  9. STRING_ARG_DECL(aout);
  10. STRING_ARG_DECL(where);
  11.     int *flag, *count, *tids, *info;
  12. {
  13.     char taout[MAX_PROC_NAME + 1];
  14.     char twhere[MAX_HOST_NAME + 1];
  15.  
  16.     /*
  17.      * Copy the program and where names to make sure there's
  18.      * a NUL at the end.
  19.      */
  20.     if (ftocstr(taout, sizeof(taout), STRING_PTR(aout), STRING_LEN(aout))) {
  21.         *info = PvmBadParam;
  22.         return;
  23.     }
  24.  
  25.     /*
  26.      * if the where parameter is '*', pass a NULL pointer to
  27.      * initiate which will allow execution on any machine.
  28.      */
  29.     if (*(STRING_PTR(where)) == '*') {
  30.         *info = pvm_spawn(taout, (char**)0, *flag, "", *count, tids);
  31.  
  32.     } else {
  33.         if (ftocstr(twhere, sizeof(twhere), STRING_PTR(where), STRING_LEN(where))) {
  34.             *info = PvmBadParam;
  35.             return;
  36.         }
  37.  
  38.         *info = pvm_spawn(taout, (char**)0, *flag, twhere, *count, tids);
  39.     }
  40. }
  41.  
  42.